//
//  UIColor+Extensions.swift
//  Media
//
//  Created by han on 2021/6/8.
//

import UIKit

extension UIColor {
    static let main = UIColor(hex6: 0x9ACFFF)
    static let mainDark = UIColor(hex6: 0x6DB5F5)
}

extension UIColor {
    convenience init(hex6: UInt32, alpha: CGFloat = 1) {
        let divisor = CGFloat(255)
        let red: CGFloat = CGFloat((hex6 & 0xFF0000) >> 16) / divisor
        let green: CGFloat = CGFloat((hex6 & 0x00FF00) >> 8) / divisor
        let blue: CGFloat = CGFloat((hex6 & 0x0000FF)) / divisor
        if #available(iOS 10.0, *) {
            self.init(displayP3Red: red, green: green, blue: blue, alpha: alpha)
        } else {
            self.init(red: red, green: green, blue: blue, alpha: alpha)
        }
    }
}


